package com.ask.exceptionDemo.demo1;

public class case1 {
    public static void main(String[] args) {
        try {
            saveAge(101);
        } catch (AgeIllegalException e) {
            e.printStackTrace();
        }
    }
    public static void saveAge(int age) throws AgeIllegalException {
        if (age > 0 && age < 100) {
            System.out.println("年龄合法");
        } else {
            throw new AgeIllegalException("age is illegal ,your age is:" +age  );
        }
    }
}
